package com.wqtz.chechai.adapter;

import android.graphics.Color;
import android.view.View;

import com.makeramen.roundedimageview.RoundedTransformationBuilder;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Transformation;
import com.wqtz.chechai.R;
import com.wqtz.chechai.base.rebaseadapter.MyHolder;
import com.wqtz.chechai.base.rebaseadapter.RecyclerAdapter;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2017/1/11 15:42
 */

public class ImagesAdapter extends RecyclerAdapter<String> {
	Transformation transformation;
	public ImagesAdapter(int rsId, List<String> data) {
		super(rsId, data);
		transformation = new RoundedTransformationBuilder()
				.borderWidthDp(3)
				.cornerRadiusDp(5)
				.oval(false)
				.build();

	}

	delOnClickCallBack mDelOnClickCallBack;
	//设置监听事件回调回调
	public void setDelOnClickCallBack(delOnClickCallBack mDelOnClickCallBack){
		this.mDelOnClickCallBack = mDelOnClickCallBack;
	}

	@Override
	public int itemType(int position) {
		return 0;
	}



	@Override
	public void onBindMyViewHolder(MyHolder holder, final int position, List<String> data) {
		holder.setRoundImag(R.id.selectedImg,data.get(position));
		if(data.get(position).equals("default")){
			holder.getView(R.id.del_mark).setVisibility(View.GONE);
			holder.getView(R.id.selectedImg).setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					mDelOnClickCallBack.onDelClick(position);
				}
			});
		}else {
			holder.getView(R.id.del_mark).setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					mDelOnClickCallBack.onDelClick(position);
				}
			});
		}

	}

	public interface delOnClickCallBack{
		void onDelClick(int position);
	}
}
